/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package dameki.game;

/**
 *
 * @author martnath
 */
public class Stone {

    private int posX;
    private int posY;
    private boolean isDame;
    private boolean color;
    
    public Stone(FakeStone fs){
        this.color = fs.getColor();
        this.isDame = fs.IsDame();
        this.posX = fs.getPosX();
        this.posY = fs.getPosY();
    }
    
    public Stone(boolean color){
        this.color = color;
        isDame = false;
    }
    public Stone(boolean color,int posX,int posY){
        this.color = color;
        this.posX = posX;
        this.posY = posY;
        isDame = false;
    }
    
    public int getPosX() {
        return posX;
    }

    public int getPosY() {
        return posY;
    }

    public boolean IsDame() {
        return isDame;
    }

    public void setPosX(int posX) {
        this.posX = posX;
    }

    public void setPosY(int posY) {
        this.posY = posY;
    }

    public void setDame(boolean dame) {
        this.isDame = dame;
    }

    public boolean getColor() {
        return this.color;
    }
    
    public void setColor(boolean color){
        this.color = color;
    }
    
    @Override
    public Stone clone()
    {
        Stone stone = new Stone(this.getColor());
        
        stone.setColor(this.getColor());
        stone.setPosX(this.getPosX());
        stone.setPosY(this.getPosY());
        stone.setDame(this.IsDame());
        
        return stone;
    }
    
    public String toString(){
        String scol = color?"White":"Black";
        return scol+": x"+posX+", y"+posY;
    }
    
    public Stone newPosition(int posY,int posX){
        Stone t = new Stone(color);
        t.setPosX(posX);
        t.setPosY(posY);
        if(isDame)
            t.setDame(true);
        return t;
    }
    
    public boolean equals(Stone s){
        if(this.color==s.color && this.isDame == s.isDame && s.posX == this.posX && this.posY == s.posY)
            return true;
        else
            return false;
    }
}

